<template>
  <uni-nav-bar title="加注机列表" left-icon="left" @clickLeft="navBack" :fixed="true" statusBar></uni-nav-bar>
  <scroll-view scroll-y="true" enable-back-to-top @scrolltolower="loadMore" class="scroll-box"
    :style="{ height: pageHeight + 'px' }">
    <FillList :fillList="fillList"></FillList>
  </scroll-view>
  <view class="add" @click="navTo('administrator/keyaccount/addFill?type=new&id='+TeamInfo.KeyCustom.id)">新增加注机</view>
</template>

<script setup lang="ts">
  import { navBack, navTo } from '@/utils/navigator';
  import { ref } from 'vue';
  import { showLoading } from '@/utils/prompt';
  import FillList from '@c/administrator/List/fillList.vue';
  import { getCustomersFlii } from '@/gql/administrator';
  import { onShow } from '@dcloudio/uni-app';
  import { toPublish } from '@mqtt';
  import { information } from '@/stores/administrator';
  const TeamInfo = information();
  const fillList = ref([])
  const pageHeight = ref();
  uni.getSystemInfo({
    success: function (res) {
      pageHeight.value = res.windowHeight - 120;
    },
  });
  onShow(() => {
    FillAll()
  })
  //加注机列表
  function FillAll() {
    showLoading()
    const payload = {
      query: getCustomersFlii,
      variables: {
        customers_id: Number(TeamInfo.KeyCustom.id),
        type: 'use'
      },
    };
    toPublish(
      'ql/control/getCustomersFlii',
      payload,
      (obj : any) => {
        const { getCustomersFlii } = obj.data;
        fillList.value = getCustomersFlii
      }
    );
  }
</script>

<style scoped lang="less">
  .add {
    width: 480rpx;
    height: 100rpx;
    background: linear-gradient(-10deg, #2C96F9, #1B91FF);
    border-radius: 5px;
    text-align: center;
    line-height: 100rpx;
    color: #fff;
    margin: 20rpx auto;
    font-size: 32rpx;
  }
</style>